package com.education.wisdom.controller.app;


import com.education.common.core.BaseController;
import com.education.wisdom.pojo.Banner;
import com.education.wisdom.service.IBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 广告位轮播 信息操作处理
 * 
 * @author ruoyi
 * @date 2018-12-26
 */
@Controller
@RequestMapping("/banner")
@Slf4j
@Api(tags = {"广告位展示"})
@CrossOrigin
public class BannerController extends BaseController
{

	@Autowired
	private IBannerService bannerService;


	/***
	 * 二级页面轮播图
	 * @param response
	 * @throws Exception
	 */
	@ApiOperation("二级轮播图展示")
    @GetMapping("/second")
    @ResponseBody
    public void banner(HttpServletResponse response) throws Exception
    {
    	List<Banner> list = bannerService.appBannerList();
        writeJSON(list,response,"200","success");
    }


	/***
	 * 首页视频位
	 * @param response
	 * @throws Exception
	 */
	@ApiOperation("首页视频位")
	@GetMapping("/first")
	@ResponseBody
	public void video(HttpServletResponse response) throws Exception
	{
		Banner banner = bannerService.firstVideo();
		writeJSON(banner,response,"200","success");
	}
	
}
